home *** CD-ROM | disk | FTP | other *** search
- /*
- File: USBKeypad.h
-
- Contains: Header file for MacAlly TenKey Keypad Module
-
- Version: xxx put version here xxx
-
- Copyright: © 1997-1998 by Apple Computer, Inc., all rights reserved.
-
- */
- #ifndef __MacAllyTenKeyH__
- #define __MacAllyTenKeyH__
-
- #include <Types.h>
- #include <Devices.h>
- #include <DriverServices.h>
- #include <Processes.h>
- #include <USB.h>
-
- void PostUSBKeyToMac(UInt16 rawUSBkey);
- void PostADBKeyToMac(UInt16 virtualKeycode, UInt8 state);
-
- void USBDemoKeyIn(UInt32 refcon, void * theData);
- void InitUSBKeyboard(void);
- void KBDHIDNotification(UInt32 devicetype, UInt8 NewHIDData[], UInt8 OldHIDData[]);
-
- Boolean SetBit(UInt8 *bitmapArray, UInt16 index, Boolean value);
-
- static OSStatus MacAllyTenKeyDeviceInitialize(USBDeviceRef device, USBDeviceDescriptorPtr pDesc, UInt32 busPowerAvailable);
- static OSStatus MacAllyTenKeyInterfaceInitialize(UInt32 interfacenum, USBInterfaceDescriptorPtr pInterface, USBDeviceDescriptorPtr pDesc, USBDeviceRef device);
- static OSStatus MacAllyTenKeyFinalize(USBDeviceRef theDeviceRef, USBDeviceDescriptorPtr pDesc);
-
- void InitiateTransaction(USBPB *pb);
- void TransactionCompletionProc(USBPB *pb);
-
- void DriverEntry(USBDeviceRef device, USBDeviceDescriptorPtr pDesc, UInt32 busPowerAvailable);
-
- void ProcessInterruptReport(UInt8 hidReport[]);
-
- #define kKeyboardRetryCount 3
- #define kKeyboardModifierBits 8
- #define kKeyboardReportKeys 2
- #define kKeyboardOffsetToKeys 2
- #define kKeyboardReportSize 4
-
- enum driverstages
- {
- kUndefined = 0,
- kSetKeyboardLEDs,
- kFindInterface,
- kOpenDevice,
- kNewInterfaceRef,
- kConfigureInterface,
- kGetReportDescriptor,
- kFindInterruptPipe,
- kReadInterruptPipe,
- kReturnFromDriver = 0x1000,
- kRetryTransaction = 0x2000,
- kSyncTransaction = 0x4000,
- kCompletionPending = 0x8000
- };
-
- typedef struct
- {
- USBPB pb;
- void (*handler)(USBPB *pb);
-
- USBDeviceRef deviceRef;
- USBInterfaceRef interfaceRef;
- USBPipeRef pipeRef;
-
- USBDeviceDescriptor deviceDescriptor;
- USBInterfaceDescriptor interfaceDescriptor;
-
- USBConfigurationDescriptorPtr pFullConfigDescriptor;
- USBInterfaceDescriptorPtr pInterfaceDescriptor;
- USBEndPointDescriptorPtr pEndpointDescriptor;
-
- UInt32 configurationNumber;
- UInt32 interfaceNumber;
-
- UInt32 hidDeviceType;
-
- UInt32 hidReportSize;
- UInt8 hidReport[8];
- UInt8 oldHIDReport[8];
- UInt8 padding[8];
- UInt8 hidReportDescriptor[256];
-
- Boolean sendRawReportFlag;
- Boolean hidEmulationInit;
-
- UInt32 interruptRefcon;
-
- SInt32 retryCount;
- SInt32 delayLevel;
- SInt32 transDepth;
- } usbMacAllyPBStruct;
-
- #endif //__MacAllyTenKeyH__